agnus: anchor below-hard-start DDFSTRT runs at their raw fetch grid#142
Merged
Conversation
A DDFSTRT below the hardwired start window ($18) fires its comparator while SHW is still down, so a fresh line starts no run; but OCS only clears SHW when a fetch run completes, so the latch survives a run-less line and the next line's match does arm a run - anchored at the raw comparator position and draining through the hardware stop, on alternating rasters. The sequencer walk already produced this DMA pattern; the renderer discarded it: captured origins below $18 were dropped, placement clamped sub-$18 starts to the hard start, and the no-run rasters were painted from the register window anyway. Renderer changes (hardware-verified by the vAmigaTS Agnus/DDF oldhwstop3/4 A500 photos): - apply_captured_fetch_geometry accepts comparator-anchored origins below the hard start (origin 0 keeps the register view: DDFSTRT=0 is the no-window sentinel, TODO noted). - effective_ddf_start_hpos / effective_ddf_window keep sub-$18 starts linear instead of flooring to $18; FMODE=0 placement drops the hard-start clamp on its round-up grid alignment (wide FMODE keeps it). - A row whose register DDFSTRT sits below $18 with no captured fetch paints nothing (the no-run rasters of the alternation). - Lines beginning inside a run carried across the line wrap report no run origin (the tail is not a comparator anchor) and keep the register view as before. - A captured run origin also rewrites the row's control segments and is authoritative for the row's word count, so band-entry rows paint the captured run instead of a synthetic register-window fallback. vAmigaTS Agnus/DDF: oldhwstop3_ocs 9.52% -> 0.25%, oldhwstop4_ocs 7.53% -> 0.23%, hwstop3-6_ocs 6.3/6.4/6.4/3.7% -> 0.4-0.7%, single4/5 and the ECS hwstop family improve as well; no case in the bucket regresses by more than 0.12pp. The 14-demo byte-identity gate holds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Model the behaviour of a DDFSTRT programmed below the hardwired start
window ($18), fixing the vAmigaTS Agnus/DDF oldhwstop3/4 divergence and
most of the hwstop/single band residuals with it.
Hardware model
The DDF sequencer flop walk (transcribed from vAmiga, pinned by the
oldhwstop A500 photos) already produced the right DMA pattern for
DDFSTRT=$10: the comparator fires while SHW is still down, so a fresh
line starts no run; but OCS only clears SHW when a fetch run completes,
so the latch survives a run-less line and the NEXT line's $10 match does
arm a run - anchored at the raw $10 fetch grid, draining through the
hardware stop. Such lines fetch on alternating rasters, with the picture
sitting linearly left of the standard grid (the early words run through
the left border, kept visible by the tests' unreachable DIWSTOP h-flop
wrap).
The divergence was renderer-side: the captured run geometry was
discarded for origins below $18 ("keep the register view"), the
register-derived placement clamped sub-$18 starts to the hard start, and
the no-run lines were painted from the register window anyway.
Changes (renderer only - the bus walk was already correct)
apply_captured_fetch_geometryaccepts comparator-anchored originsbelow the hard start (origin 0 keeps the register view: DDFSTRT=0 is
the "no window" sentinel; TODO noted).
effective_ddf_start_hpos/effective_ddf_windowkeep sub-$18starts linear instead of flooring to $18 (values >= $18 unchanged);
FMODE=0 placement (
fetch_origin_native_shift) drops the hard-startclamp on its round-up grid alignment (wide-FMODE placement keeps it).
paints nothing (the no-run rasters of the alternation).
run origin (
run_origin_cck = None): the continuation tail is not acomparator anchor, and those lines keep the register view as before.
is authoritative for the row's word count, so band-entry rows (copper
rewrites landing at the start of the next line's segment list) paint
the captured run instead of a synthetic register-window fallback.
Results (vAmigaTS Agnus/DDF, diff% vs vAmiga 4.4 refs)
Target cases:
The same model closes most of the neighbouring band residuals:
hwstop3_ocs 6.29 -> 0.45, hwstop4/5_ocs 6.42 -> 0.42, hwstop6_ocs
3.72 -> 0.69, hwstop2_ecs 11.14 -> 8.86, hwstop4/5_ecs 10.08 -> 8.64,
hwstop6_ecs 9.94 -> 8.16, single4_ecs 4.92 -> 0.99, single4_ocs
3.12 -> 0.59, single5_ecs 4.06 -> 2.23, single5_ocs 2.41 -> 0.53,
single1/2_ecs -1.6/-1.8, doublematch1_ocs 1.03 -> 0.01, oldhwstop1_ecs
1.44 -> 0.65, oldhwstop2_ecs 7.38 -> 6.77, plus small improvements
across the DDFTIM family. No case in the bucket regressed by more than
0.12pp (reenable1_ecs 0.16 -> 0.28 is the only positive delta).
Ground truth: the oldhwstop3/4 A500 OCS photos shipped with the test
suite, which vAmiga matches.
Gates
cargo test --lib(1329 green),cargo clippyandcargo fmt --checkclean.
KS1.3/A1200 boots, Second Nature, Roots ECS/AGA, Gods, Rebirth, Turbo
Tomato, Zool): all IDENTICAL.
alternation and raw-grid anchoring (OCS + ECS), bus-level run-origin
reporting (carried wrap vs armed line), renderer placement linearity
below the hard start.